package com.fivium.bpd.editor;

import java.util.Hashtable;

import com.mxgraph.util.mxConstants;
import com.mxgraph.view.mxStylesheet;

public class StyleManager
{
  public static final String BPD_STANDARD_STAGE = "STAGE_STANDARD";
  public static final String BPD_ENTRY_STAGE = "STAGE_ENTRY";
  public static final String BPD_EXIT_STAGE = "STAGE_EXIT";
  
  private static Hashtable<String, Object> standardStageStyle_;
  private static Hashtable<String, Object> standardEntryStyle_;
  private static Hashtable<String, Object> standardExitStyle_;
  
  public static void initialize(mxStylesheet stylesheet)
  {
    if (standardEntryStyle_ == null) {
      standardEntryStyle_ = new Hashtable<String, Object>();
          
      standardEntryStyle_.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RECTANGLE);
      standardEntryStyle_.put(mxConstants.STYLE_FILLCOLOR, "#FFFF99");
      standardEntryStyle_.put(mxConstants.STYLE_STROKECOLOR, "#008000");
      standardEntryStyle_.put(mxConstants.STYLE_FONTCOLOR, "#000000");
      standardEntryStyle_.put(mxConstants.STYLE_ROUNDED, true);
    }
    
    if (standardStageStyle_ == null) {
      standardStageStyle_ = new Hashtable<String, Object>();
          
      standardStageStyle_.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RECTANGLE);
      standardStageStyle_.put(mxConstants.STYLE_FILLCOLOR, "#FFFF99");
      standardStageStyle_.put(mxConstants.STYLE_STROKECOLOR, "#008000");
      standardStageStyle_.put(mxConstants.STYLE_FONTCOLOR, "#000000");
    }
    
    if (standardExitStyle_ == null) {
      standardExitStyle_ = new Hashtable<String, Object>();
          
      standardExitStyle_.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RECTANGLE);
      standardExitStyle_.put(mxConstants.STYLE_FILLCOLOR, "#FFFF99");
      standardExitStyle_.put(mxConstants.STYLE_STROKECOLOR, "#008000");
      standardExitStyle_.put(mxConstants.STYLE_FONTCOLOR, "#000000");
      standardExitStyle_.put(mxConstants.STYLE_ROUNDED, true);
    }
    
    stylesheet.putCellStyle(BPD_ENTRY_STAGE, standardEntryStyle_);
    stylesheet.putCellStyle(BPD_STANDARD_STAGE, standardStageStyle_);
    stylesheet.putCellStyle(BPD_EXIT_STAGE, standardExitStyle_);
  }
}
